package com.example.vthread;

public class Collect {

    public static Thread[] range(int endExclusive) {

        Thread[] array = new Thread[endExclusive];
        for (int i = 0; i < endExclusive; i++) {
            final int i2 = i;
            Thread thread = Thread.ofVirtual().unstarted(() -> {
                System.out.println("Hello, World " + i2);
            });

            array[i] = thread;
        }

        return array;
    }
}
